home *** CD-ROM | disk | FTP | other *** search
- property left, right, top, bottom, margin, picGap, picTop, currentPic, currentText, currentBack, currentLabel, siteLabels, channel, numPics, totalPicLength, thumbs, changed
- global currentSite, currentFullScreen, sitesVisited
-
- on new me
- currentSite = EMPTY
- sitesVisited = []
- thumbs = []
- left = 10
- right = 476
- top = 525
- bottom = 596
- margin = 3
- picGap = 4
- picTop = 92
- totalPicLength = 0
- channel = 81
- siteLabels = [#Abbey: "Abbey & Heritage Vaults", #Assembly_Rooms: "Assembly Rooms & Museum of Costume", #Postal_Museum: "Bath Postal Museum", #Bath_Museum: "Building of Bath Museum", #Floral: "Floral Bath", #Guildhall: "Guildhall", #Art_Museum: "Holburne Museum of Art", #Jane_Austen: "Jane Austen Centre", #Micro_World: "Impossible Microworld", #Pump_Room: "Pump Room", #Georgian_Gems: "More Georgian Gems", #Work_Museum: "Museum of Bath at Work", #Asian_Museum: "Museum of East Asian Art", #New_Spa: "New Spa", #No1: "No. 1 Royal Crescent", #Pulteney_Bridge: "Pulteney Bridge", #Roman_Baths: "Roman Baths", #Royal_Crescent: "Royal Crescent & Circus", #Sally_Lunn: "Sally Lunn's House", #Shopping: "Shopping & Entertainment", #Victoria: "Victoria Art Gallery", #Around_Bath: "Around Bath"]
- return me
- end
-
- on setSite me, site
- if site <> currentSite then
- sprite(14).visible = 0
- sprite(15).visible = 0
- sprite(11).visible = 0
- if soundBusy(2) then
- sound fadeOut 2, 100
- sound stop 2
- end if
- currentPic = VOID
- currentText = VOID
- currentSite = site
- currentLabel = getaProp(siteLabels, site)
- changed = 1
- else
- changed = 0
- end if
- end
-
- on loadSite me
- if not changed then
- return
- end if
- clear(me)
- setBack(me, currentSite)
- member("Label").text = currentLabel
- sprite(15).visible = 1
- fillThumbs(me)
- renderThumbs(me)
- setText(me, (the member of sprite channel).name)
- changed = 0
- set the member of sprite 11 to "icon_audio0"
- sprite(11).visible = 1
- if getPos(sitesVisited, currentSite) = 0 then
- append(sitesVisited, currentSite)
- playVoice(me, currentSite)
- end if
- end
-
- on clear me
- setPic(me, "dummy_image")
- setText(me, "dummy_text")
- repeat with i in thumbs
- i.member = member("dummy", 1)
- i.loc = point(1000, 1000)
- end repeat
- thumbs = []
- totalPicLength = 0
- end
-
- on setPic me, pic
- if member(the member of sprite 13).name = pic then
- return
- end if
- set the locV of sprite 16 to 1000
- if pic <> VOID then
- currentPic = pic
- else
- currentPic = (the member of sprite channel).name
- end if
- set the blend of sprite 13 to 0
- sprite(16).visible = 0
- if the number of member currentPic of castLib "Images" > 0 then
- set the member of sprite 13 to member(currentPic, "Images")
- else
- set the memberNum of sprite 13 to 1
- currentPic = member(1).name
- end if
- set the locV of sprite 13 to picTop + (member(currentPic, "Images").height / 2.0)
- repeat with i = 1 to 5
- set the blend of sprite 13 to i * 20
- updateStage()
- end repeat
- if the number of member currentPic of castLib "captions" > 0 then
- set the member of sprite 16 to member(currentPic, "captions")
- else
- set the memberNum of sprite 16 to 1
- end if
- set the locV of sprite 16 to the bottom of sprite 13 + 5
- sprite(16).visible = 1
- end
-
- on setText me, text
- if text <> VOID then
- currentText = text
- if the number of member currentText of castLib "Texts" > 0 then
- set the member of sprite 14 to member(currentText, "Texts")
- else
- if the number of member the name of the member of sprite channel of castLib "Texts" > 0 then
- set the member of sprite 14 to member((the member of sprite channel).name, "Texts")
- end if
- end if
- end if
- end
-
- on setBack me, back
- if back = VOID then
- return
- end if
- currentBack = back
- if the number of member currentBack of castLib "Backgrounds" > 0 then
- set the member of sprite 1 to member(currentBack, "Backgrounds")
- end if
- end
-
- on playVoice me, voice
- if not soundBusy(2) then
- set the volume of sound 2 to 255
- sound(2).play(member(voice, "sounds"))
- end if
- end
-
- on fillThumbs me
- numPics = the number of castMembers of castLib currentSite
- repeat with i = 1 to numPics
- thisChan = i + channel - 1
- set the castLibNum of sprite thisChan to castLib(currentSite).number
- set the memberNum of sprite thisChan to i
- set the width of sprite thisChan to member(i, currentSite).width
- set the height of sprite thisChan to member(i, currentSite).height
- totalPicLength = totalPicLength + member(i, currentSite).width + picGap
- append(thumbs, sprite(thisChan))
- end repeat
- end
-
- on renderThumbs me
- buff = 0
- repeat with i = 1 to count(thumbs)
- getAt(thumbs, i).loc = point(left + buff + (getAt(thumbs, i).width / 2), top + margin + (getAt(thumbs, i).height / 2))
- buff = buff + getAt(thumbs, i).width + picGap
- end repeat
- if totalPicLength < (right - left + 15) then
- sprite(66).visible = 0
- sprite(67).visible = 0
- else
- sprite(66).visible = 1
- sprite(67).visible = 1
- end if
- repeat with i in thumbs
- i.visible = 1
- end repeat
- updateStage()
- end
-
- on Shift me, direction
- found = 0
- rightEdge = right
- leftEdge = left
- if (direction = #prior) and (thumbs[1].left < (left - picGap)) then
- repeat with i = count(thumbs) down to 1
- if getAt(thumbs, i).left < (left - picGap) then
- leftEdge = getAt(thumbs, i).left
- exit repeat
- end if
- end repeat
- slide(thumbs, left - leftEdge)
- else
- if (direction = #next) and (thumbs[count(thumbs)].right > (right + picGap)) then
- repeat with i in thumbs
- if i.right > (right + picGap) then
- rightEdge = i.right
- exit repeat
- end if
- end repeat
- slide(thumbs, -(rightEdge - right))
- end if
- end if
- updateStage()
- end
-
- on slide array, dist
- if dist = 0 then
- return
- end if
- polarity = dist / abs(dist)
- travelled = 0
- speed = 10
- repeat while abs(travelled) < abs(dist)
- dx = min(max(1, (1 - (travelled / float(abs(dist)))) * speed), abs(dist) - abs(travelled))
- repeat with i in array
- i.locH = i.locH + (dx * polarity)
- end repeat
- updateStage()
- travelled = travelled + dx
- end repeat
- end
-
- on wait amount
- start = the ticks
- repeat while (the ticks - start) < amount
- end repeat
- end
-